package Lesson4;

import java.util.Scanner;

public class Task6 {

	public static void main(String[] args) {

		Scanner sc = new Scanner (System.in);
		
		System.out.println("Enter the length of the array: ");
		int n = sc.nextInt();
		
		int [][] m = new int [n][n];
		
		int numbers ;
		
		for(int i = 0; i < n; i++)
		{
			System.out.println("Enter the numbers on the " + (i+1) + " row: ");
			for(int j = 0; j<m[i].length; j++)
			{
				numbers = sc.nextInt();
				m[i][j] = numbers;
			}
		}
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j<m[i].length; j++)
			{
				System.out.print(m[i][j] + " ");
			}
			System.out.println();
		}
		
		System.out.println("Enter the A and B  points of the interval");
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j<m[i].length; j++)
			{
				if (m[i][j] > a && m[i][j] < b)
				{
					m[i][j] = 0;
				}
				
			}
		}
		
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j<m[i].length; j++)
			{
				System.out.print(m[i][j] + " ");				
			}
			System.out.println();
		}
	}

}
